package com.lankystar.logistucs.spring.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.lankystar.logistucs.spring.dao.IBaseDao;

@Repository
public class BaseDaoImpl implements IBaseDao{

	@Autowired
	private SessionFactory sf;
	
	public Session getSession(){
		System.out.println("开启session！！");
		return sf.getCurrentSession();
	}
	
	@Override
	public <T> void add(T record) {
		getSession().save(record);
	}

	@Override
	public <T> void delete(T record) {
		getSession().delete(record);
	}

	@Override
	public <T> void update(T record) {
		getSession().update(record);
	}


}
